package com.logistics.common;

/**
 * 租户上下文持有者
 * 使用 ThreadLocal 存储当前请求的租户ID
 */
public class TenantContextHolder {
    
    private static final ThreadLocal<Long> TENANT_ID = new ThreadLocal<>();
    
    /**
     * 设置租户ID
     */
    public static void setTenantId(Long tenantId) {
        TENANT_ID.set(tenantId);
    }
    
    /**
     * 获取租户ID
     */
    public static Long getTenantId() {
        return TENANT_ID.get();
    }
    
    /**
     * 清除租户ID
     */
    public static void clear() {
        TENANT_ID.remove();
    }
}

